package com.hf.security

class OrderUser {
	String name

	boolean isOrderFrequent

	BigDecimal oweMoney = 0
	boolean isPaid

	boolean hasSummary

	String email
	String password

	static constraints = {
		name(nullable:false,blank:false,unique:true)

		isOrderFrequent(nullable:false)
		
		oweMoney(nullable:false)
		isPaid(nullable:false)

		hasSummary(nullable:false)

		email(nullable:false,blank:false, email:true,unique:true)
		password(nullable:false,blank:false)

	}

	static mapping = { sort oweMoney : "desc" }

	String toString() {
		return "$name"
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this.is(obj))
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		OrderUser other = (OrderUser) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
}
